<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
  <title>加载行政区划边界</title>
  <link rel="stylesheet" href="https://js.arcgis.com/4.26/esri/themes/light/main.css">
  <script src="https://js.arcgis.com/4.26/"></script>
  <style>
    #viewDiv {
      height: 100vh;
      width: 100vw;
      margin: 0;
      padding: 0;
    }
  </style>
</head>

<body>
  <div id="viewDiv"></div>
  <script>
    require([
      "esri/Map",
      "esri/views/MapView",
      "esri/layers/GeoJSONLayer"
    ], function (Map, MapView, GeoJSONLayer) {
      var map = new Map({
        basemap: "streets"
      });

      var view = new MapView({
        container: "viewDiv",
        map: map,
        zoom: 6, // Sets zoom level based on level of detail (LOD)
        center: [85, 42.2] // Sets center point of view using longitude,latitude
      });

      var geojsonLayer = new GeoJSONLayer({
        // url: "http://localhost:8019/baseApi/650000.geoJson",
        // url: "http://localhost:8019/baseApi/test.geoJson",
        //https://geo.datav.aliyun.com/areas_v3/bound/650000.json
        url: "https://geo.datav.aliyun.com/areas_v3/bound/geojson?code=650000_full",
        renderer: {
          type: "simple", // autocasts as new SimpleRenderer()
          symbol: {
            type: "simple-fill", // autocasts as new SimpleFillSymbol()
            // style: "none",
            color: [125, 38, 255, 0.7],
            outline: {
              width: 0.5,
              color: "white"
            }
          },
          label: "County boundaries"
        },
        labelingInfo: [
          {
            labelExpression: "[name]",
            labelPlacement: "always-horizontal",
            symbol: {
              type: "text", // autocasts as new TextSymbol()
              color: [255, 255, 255, 0.7],
              haloColor: [0, 0, 0, 0.7],
              haloSize: 1,
              font: {
                size: 11
              }
            },
          }
        ]
      });

      map.add(geojsonLayer);
    });
  </script>
</body>

</html>